package panda.li.navigation.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;

import butterknife.Bind;
import butterknife.ButterKnife;
import panda.li.navigation.R;
import panda.li.navigation.base.ActivityCollector;
import panda.li.navigation.base.BaseActivity;
import panda.li.navigation.entity.NewsInfo;
import panda.li.navigation.utils.AMapUtil;

/**
 */
public class NewsInfoActivity extends BaseActivity {

    private NewsInfo newsInfo;



    @Bind(R.id.tv_title)
    TextView tv_title;
    @Bind(R.id.tv_createdate)
    TextView tv_createdate;
    @Bind(R.id.tv_content)
    TextView tv_content;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news_detail);
        ButterKnife.bind(this);

        newsInfo = (NewsInfo) getIntent().getSerializableExtra("newsInfo");
        if(newsInfo != null){
            tv_title.setText(newsInfo.getTitle());
            tv_createdate.setText(AMapUtil.convertToTime(newsInfo.getCreatedate()));
            tv_content.setText(newsInfo.getContent());
        }else{

            tv_title.setText("暂无数据!");
            tv_createdate.setText("");
            tv_content.setText("");
        }

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ActivityCollector.removeActivity(this);
    }
}
